﻿
using System;
using System.Collections;

namespace Xacml.Core.Policy
{
  public class TargetItemCollection : TargetItemCollectionReadWrite
  {
    public TargetItemCollection(TargetItemCollectionReadWrite items)
    {
      foreach (TargetItemBaseReadWrite itemBaseReadWrite in (CollectionBase) items)
      {
        if (itemBaseReadWrite is SubjectElementReadWrite)
          this.List.Add((object) new SubjectElement(itemBaseReadWrite.Match, itemBaseReadWrite.SchemaVersion));
        else if (itemBaseReadWrite is ActionElementReadWrite)
          this.List.Add((object) new ActionElement(itemBaseReadWrite.Match, itemBaseReadWrite.SchemaVersion));
        else if (itemBaseReadWrite is ResourceElementReadWrite)
          this.List.Add((object) new ResourceElement(itemBaseReadWrite.Match, itemBaseReadWrite.SchemaVersion));
        else if (itemBaseReadWrite is EnvironmentElementReadWrite)
          this.List.Add((object) new EnvironmentElement(itemBaseReadWrite.Match, itemBaseReadWrite.SchemaVersion));
      }
    }

    public TargetItemCollection()
    {
    }

    public override void Clear()
    {
      throw new NotSupportedException();
    }

    public override void RemoveAt(int index)
    {
      throw new NotSupportedException();
    }
  }
}
